package hanmeng.feisha.hotdemo;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication  
@RestController 
public class HotdemoApplication {
	public static void main(String[] args) {
		SpringApplication.run(HotdemoApplication.class, args);
	}
	
	@RequestMapping("/")
    String home() {
        return "Hello World!";
    }

    @RequestMapping("/now")
    String hehe() {
    	
        return "现在时间：" + (new Date()).toLocaleString();
    }
    @RequestMapping("/test")  
    public String firsttest() {  
        return "ftest";  
    }  
    @RequestMapping(value="/say",method=RequestMethod.GET)
	public String say(HttpServletRequest request) {
		// 这个say会在html中用到，
		request.setAttribute("say","hello hanyafei");
		// 这个返回值 是要和html的名字一致的。		
		return "hanyafei333";
	}
}
//热部署 https://www.imooc.com/video/16072
//打包  run as  选择 maven install 
//target下 jar 命令 运行jar包
//D:\ka_fa\sts\hotdemo\target\hotdemo-0.0.1-SNAPSHOT.jar
//java -jar hotdemo-0.0.1-SNAPSHOT.jar
//